Memory leak fixes.
authoroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 5 Apr 2006 17:37:31 +0000 (17:37 +0000)
committeroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 5 Apr 2006 17:37:31 +0000 (17:37 +0000)
gpsbabel/interpolate.c

index f9cbdb2d746ba2b22a341ee6caabd1e3a39711da..9a4755bb71102a8b11fd130d656f9954983ecb5c 100644 (file)
@@ -84,7 +84,10 @@ interpfilt_process(void)
                                waypoint *wpt_new = waypt_dupe(wpt);
                                wpt_new->creation_time = timen;
                                xfree(wpt_new->shortname);
-                               xfree(wpt_new->description);
+                               if (wpt_new->description) {
+                                   xfree(wpt_new->description);
+                                   wpt_new->description = NULL;
+                               }
                                wpt_new->shortname = wpt_new->description = 0;
                                linepart( lat1, lon1, 
                                          wpt->latitude, wpt->longitude,
@@ -110,7 +113,10 @@ interpfilt_process(void)
                                wpt_new->creation_time = distn/curdist*
                                        (wpt->creation_time - time1) + time1;
                                xfree(wpt_new->shortname);
-                               xfree(wpt_new->description);
+                               if (wpt_new->description) {
+                                   xfree(wpt_new->description);
+                                   wpt_new->description = NULL;
+                               }
                                wpt_new->shortname = wpt_new->description = 0;
                                linepart( lat1, lon1, 
                                          wpt->latitude, wpt->longitude,